<template>
	<view class="me">
		<view class="headTop">
			<view class="Henantop">个人中心</view>
			<view class="logo">
				<image class="logo-img" :src="login ? uerInfo.avatarUrl :avatarUrl"></image>
				<view class="logo-title">
					<text class="uer-name">Hi，{{userName}}</text>

				</view>
			</view>
		</view>
		<view class="bodyMidel">
			<view class="mine-mid">
				<view class="mid-box" @click="goSetting">
					<view class="mid-left">
						<text class="icon iconfont icon-shezhi"></text>

						<h3 style="">设置</h3>
					</view>
					<view class="el-icon-arrow-right"></view>
				</view>
				<view class="mid-box" @click="customerService">
					<view class="mid-left">

						<text class="icon iconfont icon-wodekefu"></text>
						<h3>关于我们</h3>
					</view>

				</view>
				<view class="mid-box">
					<view class="mid-left">
						<text class="icon iconfont icon-banbenhao"></text>
						<!-- #ifdef APP-PLUS -->
						<h3>版本号 V {{version}}</h3>
						<!-- #endif -->
					</view>
				</view>

			</view>
		</view>

		<u-tabbar height="100rpx" v-model="current" :show="show" :bg-color="bgColor" :border-top="borderTop" :list="list"
			:mid-button="midButton" :inactive-color="inactiveColor" :activeColor="activeColor" size="25px"></u-tabbar>
	</view>
</template>

<script>
	import uTabbar from "@/uview-ui/components/u-tabbar/u-tabbar.vue"
	export default {
		data() {
			return {
				current: 2,
				show: true,
				bgColor: '#fff',
				borderTop: true,
				list: [{
						iconPath: "home",
						selectedIconPath: "home-fill",
						text: '首页',
						pagePath: "/pages/home/index",
						customIcon: false,

					},



					{
						iconPath: "account",
						selectedIconPath: "account-fill",
						text: '我的',

						isDot: false,
						customIcon: false,
						pagePath: "/pages/me/me",

					},
				],
				midButton: true,
				inactiveColor: 'rgba(178, 178, 178, 1)',
				activeColor: '#0863E8',
				login: false,
				avatarUrl: '/static/me/logos.png',
				uerInfo: {},
				// version: "1.0.1",
				// version: "1.0.2",
				
				// version: "1.0.3",
				version: "1.0.4",
				userName: "",
				a: "",
				b: "",
				data: "",
				userInfo: {}



			}
		},
		onLoad() {
			// this.getData()
			// 版本号
			// this.getProperty()
		},
		components: {
			uTabbar
		},
		onShow() {
			this.getData()
			this.getListData()
		},
		onTabItemTap(e) {
			// tab 点击时执行，此处直接接收单击事件
			// 
			// this.getData()
		},
		// jointHearing
		methods: {
			getListData(num) {
				var that = this

				uni.getStorage({
					key: 'userInfo',
					success: function(res) {
						that.userInfo = JSON.parse(res.data)


						// 		var num = 0
						// 		var datas = {

						// 			userId: that.userInfo.userId,
						// 			modelType: num
						// 		}

						// 		that.$http.SignList(datas).then(res => {

						// 			if (res.errcode == 0) {

						// 				if (num == 0) {

						// 					that.list[1].count = res.data.checkSignList.length
						// 				}

						// 			} else {
						// 				console.log("接口报错")
						// 			}
						// 		}, (err) => {
						// 			uni.showToast({
						// 				title: "获取数据失败",
						// 				icon: 'none',
						// 				duration: 2000
						// 			});
						// 		})
					}
				})


			},
			getData() {
				var userInfo = {}
				var that = this
				uni.getStorage({
					key: 'userInfo',
					success: function(res) {
						userInfo = JSON.parse(res.data)
						// console.log(userInfo)
						that.userName = userInfo.realName
					}
				})
			},
			getProperty() {

				plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {

					this.version = wgtinfo.version

				})
			},
			goSetting() {
				uni.navigateTo({
					url: '/pages/me/setTing'
				});
			},
			customerService() {
				uni.navigateTo({
					url: '/pages/me/customerService'
				});
			},
			scanCode() {

				// console.log(123);
				var that = this
				// 允许从相机和相册扫码
				uni.scanCode({
					onlyFromCamera: true,


					success: function(res) {
						that.a = res.scanType
						that.b = res.result
						that.data = res.result
						// console.log('条码类型：' + res.scanType);
						// console.log('条码内容：' + res.result);
					}
				});
				// #ifdef APP-PLUS
				// #endif 
			},
			scanCode1() {
				// #ifdef APP-PLUS
				// console.log(123);
				var that = this
				// 允许从相机和相册扫码
				uni.scanCode({
					onlyFromCamera: true,
					success: function(res) {
						void plus.runtime.openWeb(res.result, function() {
							// 识别失败代码
						});
						that.data = res.result
						that.a = res.scanType
						that.b = res.result
						// console.log('条码类型：' + res.scanType);
						// console.log('条码内容：' + res.result);
					}

					// success: function (res) {
					//  	that.a=res.scanType
					//  	that.b=res.result
					//        console.log('条码类型：' + res.scanType);
					//        console.log('条码内容：' + res.result);
					//    }
				});

				// #endif 
			}
		}
	}
</script>

<style scoped>
	@import url("../../common/uni.css");

	.me {
		width: 100%;
		height: 100%;
	}

	.iconfont {
		color: #0863E8;
		font-size: 48upx;
		margin-right: 30upx;

	}

	.icon-shezhi {
		font-size: 48upx;
		/* line-height: 45px; */
	}

	.Henantop {
		width: 100%;
		height: 200upx;
		/* background: #192c7c; */
		/* background:linear-gradient(to bottom right,#4771D0,#3156AC,#273C6C); */
		color: #fff;
		text-align: center;
		line-height: 280upx;
		font-size: 36upx;
		letter-spacing: 4upx;
		font-size: 36upx;
		letter-spacing: 4upx;
		font-weight: 700;
	}

	.headTop {
		width: 100%;
		height: 480upx;
		background: linear-gradient(to bottom right, #0863E8, #0A5DD8, #525EF9, #525AE0, #6A6FD6);
		/* background: #192c7c;
	color: #fff; */
	}

	.logo {
		width: 750upx;
		height: 240upx;
		padding: 30upx;
		box-sizing: border-box;
		/* background: #192c7c; */
		/* background:linear-gradient(to bottom right,#4771D0,#3156AC,#273C6C); */
		-webkit-box-orient: horizontal;
		-webkit-box-direction: normal;
		-webkit-flex-direction: row;
		flex-direction: row;
		-webkit-box-align: center;
		-webkit-align-items: center;
		align-items: center;
		display: flex;
	}

	.logo-img {
		width: 150upx;
		height: 150upx;
		border-radius: 150upx;
	}

	.logo-title {
		height: 150upx;
		line-height: 150upx;
		-webkit-box-flex: 1;
		-webkit-flex: 1;
		flex: 1;
		-webkit-box-align: center;
		-webkit-align-items: center;
		align-items: center;
		-webkit-box-pack: justify;
		-webkit-justify-content: space-between;
		justify-content: space-between;
		-webkit-box-orient: horizontal;
		-webkit-box-direction: normal;
		-webkit-flex-direction: row;
		flex-direction: row;
		margin-left: 10px;
	}

	.uer-name {
		height: 60upx;
		line-height: 70upx;
		font-size: 38upx;
		color: #FFFFFF;
	}


	.bodyMidel {
		background-color: #fff;
		/* background-color: #0081FF; */
		width: 100%;
		height: 500upx;
		margin-top: 65upx;
		padding: 30upx;

	}

	.mine-mid {
		margin-top: 60upx;
		font-size: 28upx;
	}

	.mid-box {
		height: 90upx;
		line-height: 90upx;
		position: relative;
		display: flex;
		justify-content: space-between;
		border-bottom: 1px solid #eee;

	}

	.mid-box .img {
		width: 55upx;
		height: 55upx;
		margin-right: 20upx;
	}

	.mid-left {
		padding: 0 10upx;
		display: flex;
		align-items: center;
	}

	.mid-left .img,
	.mid-left h3 {
		display: inline-block;
		vertical-align: middle;
		font-weight: 400;
	}
</style>
